package com.battle.pojo.entity;

import javax.persistence.Column;

import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.TableComment;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import jakarta.persistence.Entity;
import lombok.Data;
import nirvana.core.domains.ann.AccEntity;
import nirvana.core.domains.entity.DomainBaseEntity;
import nirvana.core.domains.enums.EntityType;

import javax.persistence.Table;

/**
 * @author Joseph.Li
 * @author joseph.li@king-v.com
 * Created in 2022-06-16 22:51
 * <p>
 * 资源的授权
 */


@Data
@TableName(value = "AUTHORIZATION")
@Entity(name = "AUTHORIZATION")
@AccEntity(value = "资源授权", type = EntityType.SECONDARY_SERVICE_ENTITY)
public class Authorization extends DomainBaseEntity<Authorization> {


    /**
     * 授权对象
     */
    @Column(nullable = false)
    private Long targetId;


    /**
     * 资源
     */
    @Column(nullable = false)
    private Long resourceId;


    /**
     * 授权值
     * <p>
     * 基础值为0 或不创建
     * 授权+1
     * 禁用-2
     * <p>
     * 1为被授权
     * -2为禁止
     * -1为授权覆盖禁止
     */
    @Column(nullable = false)
    private Integer authorizedValue;

}
